<template>
	<view class="pageAll">
		<view class="pageTopImg">
			<image :src="labelRouge"></image>
		</view>
		<view class="pageMiddleText">
			<text>{{tipMessgae}}</text>
			<view class="spinner">
				<view class="bounce1"></view>
				<view class="bounce2"></view>
				<view class="bounce3"></view>
			</view>
		</view>
		<view class="pageBottomTip">
			<view class="pageBottomTipInfo" v-for="(item, index) in tipMessageBottom" :key="index">
				<text>{{item}}</text>
			</view>
		</view>
		<!-- <logo class="Bottomlogo"></logo> -->
	</view>
</template>

<script>
	import logo from '../../../components/logo/bottomLogo.vue'
	let inter = null
	export default {
		data() {
			return {
				tipMessageBottom: [
					'如有合作疑问，请联系我们',
					' 客服电话：18925233805 ',
					'收件地址：深圳市南山区西丽民企工业园5栋3层',
				], // 底部文字
				labelRouge: require('../../../static/index/labelRougeWhite.png'), // 顶部图片
				tipMessgae: '您的资料已提交，我们将于24小时内回复您.',
				form:{
					tel:null,
					password: null,
				}
			}
		},
		methods: {
			loopGetLogin() {
				inter = setInterval(() => {
					this.$api.supplierLogin({
							username: this.form.tel,
							password: this.form.password,
							isNoNeedLoading: true,
						})
						.then(res => {
							if (res.status) {
								
								let tempType = ''
								if (res.data.type === 'user') {
									tempType = 1
								} else {
									tempType = 2
								}
								
								// *******先注释
								if (res.data.status === 'unreviewed') { // 用户状态 未审核
									if (res.data.type === 'user') {
										uni.redirectTo({
											url: '../ImprovePerInfo/ImprovePerInfo'
										})
									} else {
										uni.redirectTo({
											url: '../ImproveCorInfo/ImproveCorInfo'
										})
									}
								} else if (res.data.status === 'checked') { // 已通过
									uni.switchTab({
										url: '../../index/index/index'
									})
								} else if (res.data.status === 'audit') { // 审核中
								} else if (res.data.status === 'pass') { // 审核已通过
									uni.redirectTo({
										url: '../alreadyPass/alreadyPass'
									})
								} else if (res.data.status === 'fail') { // 审核失败
									uni.redirectTo({
										url: '../noPass/noPass?userType=' + tempType
									})
								} else if (res.data.status === 'message_finish') { //已经填写好信息 没提交审核
									uni.redirectTo({
										url: '../cooperationSigning/cooperationSigning?userType=' + tempType
									})
								}
								this.$store.commit('setToken', res.token)
								this.$store.commit('setUserInfo', res.data)
							} else {
								uni.showToast({
									title: res.msg,
									icon: 'none',
									duration: 1500,
								})
							}
							this.isWorking = false
						})
						.catch(err => {
							this.isWorking = false
						})
				}, 5000)
			}
		},
		onUnload() {
			clearInterval(inter)
		},
		onLoad(option) {
			uni.getStorage({
				key: 'userTel',
				success: res => {
					this.form.tel = res.data;
				}
			});
			uni.getStorage({
				key: 'userPwd',
				success: res => {
					this.form.password = res.data;
				}
			});
			this.loopGetLogin()
		},
		components: {
			logo,
		},
		onShareAppMessage: (options) => {
			// 设置菜单中的转发按钮触发转发事件时的转发内容
			var shareObj = {
				title: "红标HONBIAO", // 默认是小程序的名称(可以写slogan等)
				path: '/pages/indexPage/authorization/authorization', // 默认是当前页面，必须是以‘/’开头的完整路径
				imageUrl: '/static/index/labelRouge.png', //自定义图片路径，可以是本地文件路径、代码包文件路径或者网络图片路径，支持PNG及JPG，不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
				success: (res) => {
					// 转发成功之后的回调
					if (res.errMsg == 'shareAppMessage:ok') {}
				},
				fail: () => {
					// 转发失败之后的回调
					if (res.errMsg == 'shareAppMessage:fail cancel') {
						// 用户取消转发
					} else if (res.errMsg == 'shareAppMessage:fail') {
						// 转发失败，其中 detail message 为详细失败信息
					}
				}
			};
			return shareObj
		},
	}
</script>

<style scoped>
	.pageAll {
		box-sizing: border-box;
		/* background: url(../../../static/index/backImg.png) ; */
		background-color: #c1504a;
		width: 100%;
		height: 100%;
		/* padding: 0 17upx 0 17upx; */
		display: inline-block;
	}

	.pageTopImg {
		margin-top: 120upx;
		display: flex;
	}

	.pageTopImg image {
		margin: 0 auto;
		width: 602.66upx;
		height: 408.66upx;
	}

	.pageMiddleText {
		font-size: 32upx;
		text-align: center;
		margin-top: 140upx;
	}

	.pageMiddleText text {
		color: #FFF;
	}

	.spinner {
		margin: 46.66upx auto 0;
		width: 200upx;
		height: 32upx;
		text-align: center;
	}

	.spinner>view {
		width: 32upx;
		height: 32upx;
		background-color: #FFF;
		margin-right: 10upx;
		border-radius: 100%;
		display: inline-block;
		-webkit-animation: bouncedelay 1.4s infinite ease-in-out;
		animation: bouncedelay 1.4s infinite ease-in-out;
		/* Prevent first frame from flickering when animation starts */
		-webkit-animation-fill-mode: both;
		animation-fill-mode: both;
	}

	.spinner>view:last-child {
		margin-right: 0 !important;
	}

	.spinner .bounce1 {
		-webkit-animation-delay: -0.32s;
		animation-delay: -0.32s;
	}

	.spinner .bounce2 {
		-webkit-animation-delay: -0.16s;
		animation-delay: -0.16s;
	}

	@-webkit-keyframes bouncedelay {

		0%,
		80%,
		100% {
			-webkit-transform: scale(0.0)
		}

		40% {
			-webkit-transform: scale(1.0)
		}
	}

	@keyframes bouncedelay {

		0%,
		80%,
		100% {
			transform: scale(0.0);
			-webkit-transform: scale(0.0);
		}

		40% {
			transform: scale(1.0);
			-webkit-transform: scale(1.0);
		}
	}

	.pageBottomTip {
		bottom: 50upx;
		position: fixed;
		width: 100%
	}

	.pageBottomTipInfo {
		text-align: center;
		font-size: 24upx;
		color: #FFF;
		margin-bottom: 15upx;
	}
</style>
